

<!DOCTYPE html>
<html lang="zh-CN" data-default-color-scheme=auto>



<head>
  <meta charset="UTF-8">
  <link rel="apple-touch-icon" sizes="76x76" href="/img/Mine.jpg">
  <link rel="icon" href="/img/Mine.jpg">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0, shrink-to-fit=no">
  <meta http-equiv="x-ua-compatible" content="ie=edge">
  
  <meta name="theme-color" content="#2f4154">
  <meta name="author" content="Chiam">
  <meta name="keywords" content="算法，安全">
  
    <meta name="description" content="『数据库』数据库 SQL 语言从入门到精通-Part 2-MySQL 安装数据库从入门到精通合集（超详细，学习数据库必看） 首先给出的简单安装方式，文末给出标准的安装方式。第一步下载我的压缩包链接：https:&#x2F;&#x2F;pan.baidu.com&#x2F;s&#x2F;1EE40dU0j2U1d-bAfj7TeVA提取码：n25c复制这段内容后打开百度网盘手机 App，操作更方便哦第二步解压到D盘都放进来看图。第三步打开">
<meta property="og:type" content="article">
<meta property="og:title" content="『数据库』数据库SQL语言从入门到精通-Part 2-MySQL安装">
<meta property="og:url" content="http://example.com/2023/12/06/%E3%80%8E%E6%95%B0%E6%8D%AE%E5%BA%93%E3%80%8F%E6%95%B0%E6%8D%AE%E5%BA%93SQL%E8%AF%AD%E8%A8%80%E4%BB%8E%E5%85%A5%E9%97%A8%E5%88%B0%E7%B2%BE%E9%80%9A-Part%202-MySQL%E5%AE%89%E8%A3%85/index.html">
<meta property="og:site_name" content="Chiam 的个人主页">
<meta property="og:description" content="『数据库』数据库 SQL 语言从入门到精通-Part 2-MySQL 安装数据库从入门到精通合集（超详细，学习数据库必看） 首先给出的简单安装方式，文末给出标准的安装方式。第一步下载我的压缩包链接：https:&#x2F;&#x2F;pan.baidu.com&#x2F;s&#x2F;1EE40dU0j2U1d-bAfj7TeVA提取码：n25c复制这段内容后打开百度网盘手机 App，操作更方便哦第二步解压到D盘都放进来看图。第三步打开">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://img-blog.csdnimg.cn/20200316232640422.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80MzYyNzExOA==,size_16,color_FFFFFF,t_70">
<meta property="og:image" content="https://img-blog.csdnimg.cn/20200316232700159.png">
<meta property="og:image" content="https://img-blog.csdnimg.cn/20200308232725586.png">
<meta property="og:image" content="https://img-blog.csdnimg.cn/20200316232720667.png">
<meta property="og:image" content="https://img-blog.csdnimg.cn/20200309012519201.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80MzYyNzExOA==,size_16,color_FFFFFF,t_70">
<meta property="og:image" content="https://img-blog.csdnimg.cn/20200309003053674.png">
<meta property="og:image" content="https://img-blog.csdnimg.cn/20200308232903387.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80MzYyNzExOA==,size_16,color_FFFFFF,t_70">
<meta property="og:image" content="https://img-blog.csdnimg.cn/20200316232828669.png">
<meta property="og:image" content="https://img-blog.csdnimg.cn/20200316233006259.png">
<meta property="og:image" content="https://img-blog.csdnimg.cn/20200309011728948.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80MzYyNzExOA==,size_16,color_FFFFFF,t_70">
<meta property="article:published_time" content="2023-12-05T16:11:43.865Z">
<meta property="article:modified_time" content="2023-12-05T16:18:11.282Z">
<meta property="article:author" content="Chiam">
<meta property="article:tag" content="算法，安全">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:image" content="https://img-blog.csdnimg.cn/20200316232640422.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80MzYyNzExOA==,size_16,color_FFFFFF,t_70">
  
  
  
  <title>『数据库』数据库SQL语言从入门到精通-Part 2-MySQL安装 - Chiam 的个人主页</title>

  <link  rel="stylesheet" href="https://lib.baomitu.com/twitter-bootstrap/4.6.1/css/bootstrap.min.css" />



  <link  rel="stylesheet" href="https://lib.baomitu.com/github-markdown-css/4.0.0/github-markdown.min.css" />

  <link  rel="stylesheet" href="https://lib.baomitu.com/hint.css/2.7.0/hint.min.css" />

  <link  rel="stylesheet" href="https://lib.baomitu.com/fancybox/3.5.7/jquery.fancybox.min.css" />



<!-- 主题依赖的图标库，不要自行修改 -->
<!-- Do not modify the link that theme dependent icons -->

<link rel="stylesheet" href="//at.alicdn.com/t/font_1749284_hj8rtnfg7um.css">



<link rel="stylesheet" href="//at.alicdn.com/t/font_1736178_lbnruvf0jn.css">


<link  rel="stylesheet" href="/css/main.css" />


  <link id="highlight-css" rel="stylesheet" href="/css/highlight.css" />
  
    <link id="highlight-css-dark" rel="stylesheet" href="/css/highlight-dark.css" />
  



  
<link rel="stylesheet" href="/css/custom.css">



  <script id="fluid-configs">
    var Fluid = window.Fluid || {};
    Fluid.ctx = Object.assign({}, Fluid.ctx)
    var CONFIG = {"hostname":"example.com","root":"/","version":"1.9.5-a","typing":{"enable":true,"typeSpeed":70,"cursorChar":"_","loop":false,"scope":[]},"anchorjs":{"enable":true,"element":"h1,h2,h3,h4,h5,h6","placement":"left","visible":"hover","icon":"❡"},"progressbar":{"enable":true,"height_px":3,"color":"#29d","options":{"showSpinner":false,"trickleSpeed":100}},"code_language":{"enable":true,"default":"TEXT"},"copy_btn":true,"image_caption":{"enable":true},"image_zoom":{"enable":true,"img_url_replace":["",""]},"toc":{"enable":true,"placement":"right","headingSelector":"h1,h2,h3,h4,h5,h6","collapseDepth":2},"lazyload":{"enable":true,"loading_img":"/img/loading.gif","onlypost":false,"offset_factor":2},"web_analytics":{"enable":false,"follow_dnt":true,"baidu":null,"google":{"measurement_id":null},"tencent":{"sid":null,"cid":null},"woyaola":null,"cnzz":null,"leancloud":{"app_id":null,"app_key":null,"server_url":null,"path":"window.location.pathname","ignore_local":false}},"search_path":"/local-search.xml","include_content_in_search":true};

    if (CONFIG.web_analytics.follow_dnt) {
      var dntVal = navigator.doNotTrack || window.doNotTrack || navigator.msDoNotTrack;
      Fluid.ctx.dnt = dntVal && (dntVal.startsWith('1') || dntVal.startsWith('yes') || dntVal.startsWith('on'));
    }
  </script>
  <script  src="/js/utils.js" ></script>
  <script  src="/js/color-schema.js" ></script>
  


  
<meta name="generator" content="Hexo 6.3.0"></head>


<body>
  

  <header>
    

<div class="header-inner" style="height: 70vh;">
  <nav id="navbar" class="navbar fixed-top  navbar-expand-lg navbar-dark scrolling-navbar">
  <div class="container">
    <a class="navbar-brand" href="/">
      <strong>Chiam&#39;s Blogs</strong>
    </a>

    <button id="navbar-toggler-btn" class="navbar-toggler" type="button" data-toggle="collapse"
            data-target="#navbarSupportedContent"
            aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
      <div class="animated-icon"><span></span><span></span><span></span></div>
    </button>

    <!-- Collapsible content -->
    <div class="collapse navbar-collapse" id="navbarSupportedContent">
      <ul class="navbar-nav ml-auto text-center">
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/">
                
                <span>首页</span>
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/archives/">
                
                <span>归档</span>
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/categories/">
                
                <span>分类</span>
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/about/">
                
                <span>关于</span>
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/links/">
                
                <span>友链</span>
              </a>
            </li>
          
        
        
          <li class="nav-item" id="search-btn">
            <a class="nav-link" target="_self" href="javascript:;" data-toggle="modal" data-target="#modalSearch" aria-label="Search">
              <i class="iconfont icon-search"></i>
            </a>
          </li>
          
        
        
          <li class="nav-item" id="color-toggle-btn">
            <a class="nav-link" target="_self" href="javascript:;" aria-label="Color Toggle">
              <i class="iconfont icon-dark" id="color-toggle-icon"></i>
            </a>
          </li>
        
      </ul>
    </div>
  </div>
</nav>

  

<div id="banner" class="banner" parallax=true
     style="background: url('/img/default.png') no-repeat center center; background-size: cover;">
  <div class="full-bg-img">
    <div class="mask flex-center" style="background-color: rgba(0, 0, 0, 0.3)">
      <div class="banner-text text-center fade-in-up">
        <div class="h2">
          
            <span id="subtitle" data-typed-text="『数据库』数据库SQL语言从入门到精通-Part 2-MySQL安装"></span>
          
        </div>

        
          
  <div class="mt-3">
    
    
      <span class="post-meta">
        <i class="iconfont icon-date-fill" aria-hidden="true"></i>
        <time datetime="2023-12-06 00:11" pubdate>
          2023年12月6日 凌晨
        </time>
      </span>
    
  </div>

  <div class="mt-1">
    
      <span class="post-meta mr-2">
        <i class="iconfont icon-chart"></i>
        
          3.2k 字
        
      </span>
    

    
      <span class="post-meta mr-2">
        <i class="iconfont icon-clock-fill"></i>
        
        
        
          27 分钟
        
      </span>
    

    
    
  </div>


        
      </div>

      
    </div>
  </div>
</div>

</div>

  </header>

  <main>
    
      

<div class="container-fluid nopadding-x">
  <div class="row nomargin-x">
    <div class="side-col d-none d-lg-block col-lg-2">
      

    </div>

    <div class="col-lg-8 nopadding-x-md">
      <div class="container nopadding-x-md" id="board-ctn">
        <div id="board">
          <article class="post-content mx-auto">
            <h1 id="seo-header">『数据库』数据库SQL语言从入门到精通-Part 2-MySQL安装</h1>
            
            
              <div class="markdown-body">
                
                <h1 id="『数据库』数据库-SQL-语言从入门到精通-Part-2-MySQL-安装"><a href="#『数据库』数据库-SQL-语言从入门到精通-Part-2-MySQL-安装" class="headerlink" title="『数据库』数据库 SQL 语言从入门到精通-Part 2-MySQL 安装"></a>『数据库』数据库 SQL 语言从入门到精通-Part 2-MySQL 安装</h1><p><a target="_blank" rel="noopener" href="https://blog.csdn.net/weixin_43627118/article/details/105027257">数据库从入门到精通合集（超详细，学习数据库必看）</a></p>
<h2 id="首先给出的简单安装方式，文末给出标准的安装方式。"><a href="#首先给出的简单安装方式，文末给出标准的安装方式。" class="headerlink" title="首先给出的简单安装方式，文末给出标准的安装方式。"></a>首先给出的简单安装方式，文末给出标准的安装方式。</h2><p>第一步下载我的压缩包<br><a target="_blank" rel="noopener" href="https://pan.baidu.com/s/1EE40dU0j2U1d-bAfj7TeVA">链接</a>：<code>https://pan.baidu.com/s/1EE40dU0j2U1d-bAfj7TeVA</code><br>提取码：<code>n25c</code><br>复制这段内容后打开百度网盘手机 App，操作更方便哦<br>第二步解压到<code>D盘</code>都放进来看图。<br><img src="https://img-blog.csdnimg.cn/20200316232640422.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80MzYyNzExOA==,size_16,color_FFFFFF,t_70" srcset="/img/loading.gif" lazyload alt="在这里插入图片描述"><br>第三步打开<code>MySQL文件夹</code>，就是<code>D盘</code>的那个<br><img src="https://img-blog.csdnimg.cn/20200316232700159.png" srcset="/img/loading.gif" lazyload alt="在这里插入图片描述"><br>第四步管理员身份运行<code>环境变量.bat</code><br><img src="https://img-blog.csdnimg.cn/20200308232725586.png" srcset="/img/loading.gif" lazyload alt="在这里插入图片描述"><br><img src="https://img-blog.csdnimg.cn/20200316232720667.png" srcset="/img/loading.gif" lazyload alt="在这里插入图片描述"><br>完事了。<br>输入<code>mysql -uroot -p</code>试一下<br>密码不用输入，直接跳过。<br><img src="https://img-blog.csdnimg.cn/20200309012519201.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80MzYyNzExOA==,size_16,color_FFFFFF,t_70" srcset="/img/loading.gif" lazyload alt="在这里插入图片描述"></p>
<h3 id="安装完成"><a href="#安装完成" class="headerlink" title="安装完成"></a>安装完成</h3><p><br><br><br></p>
<hr>
<h3 id="问题解决："><a href="#问题解决：" class="headerlink" title="问题解决："></a>问题解决：</h3><h4 id="如果不行的话，任务管理（ctrl-alt-del）找一下服务"><a href="#如果不行的话，任务管理（ctrl-alt-del）找一下服务" class="headerlink" title="如果不行的话，任务管理（ctrl+alt+del）找一下服务"></a>如果不行的话，任务管理（ctrl+alt+del）找一下服务</h4><p><img src="https://img-blog.csdnimg.cn/20200309003053674.png" srcset="/img/loading.gif" lazyload alt="在这里插入图片描述"><br><img src="https://img-blog.csdnimg.cn/20200308232903387.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80MzYyNzExOA==,size_16,color_FFFFFF,t_70" srcset="/img/loading.gif" lazyload alt="在这里插入图片描述"></p>
<p><strong>根目录找到 my.ini</strong><br><img src="https://img-blog.csdnimg.cn/20200316232828669.png" srcset="/img/loading.gif" lazyload alt="在这里插入图片描述"><br><strong>删除第二行</strong></p>
<figure class="highlight cpp"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br></pre></td><td class="code"><pre><code class="hljs cpp">[mysqld]<br><span class="hljs-meta"># skip-grant-tables</span><br># 如果不输入密码报错，删除上一句的“#”然后参考前面修改密码。<br># 设置<span class="hljs-number">3306</span>端口<br>port=<span class="hljs-number">3306</span><br><br># 设置mysql的安装目录<br>basedir=D:\\Mysql\\mysql<span class="hljs-number">-8.0</span><span class="hljs-number">.19</span>-winx64<br># 设置mysql数据库的数据的存放目录<br>datadir=D:\\Mysql\\mysql<span class="hljs-number">-8.0</span><span class="hljs-number">.19</span>-winx64\\data<br># 允许最大连接数<br>max_connections=<span class="hljs-number">200</span><br># 允许连接失败的次数。这是为了防止有人从该主机试图攻击数据库系统<br>max_connect_errors=<span class="hljs-number">10</span><br># 服务端使用的字符集默认为UTF8<br>character-set-server=utf8<br># 创建新表时将使用的默认存储引擎<br><span class="hljs-keyword">default</span>-storage-engine=INNODB<br># 默认使用“mysql_native_password”插件认证<br>default_authentication_plugin=mysql_native_password<br>[mysql]<br># 设置mysql客户端默认字符集<br><span class="hljs-keyword">default</span>-character-set=utf8<br>[client]<br># 设置mysql客户端连接服务端时默认使用的端口<br>port=<span class="hljs-number">3306</span><br><span class="hljs-keyword">default</span>-character-set=utf8<br></code></pre></td></tr></table></figure>

<p><strong>再试一试</strong></p>
<h4 id="如果出现的-vcruntime140-dll-缺失"><a href="#如果出现的-vcruntime140-dll-缺失" class="headerlink" title="如果出现的 vcruntime140.dll 缺失"></a>如果出现的 vcruntime140.dll 缺失</h4><p>是因为没有 VC++的支持<br>去<a target="_blank" rel="noopener" href="https://support.microsoft.com/zh-cn/help/2977003/the-latest-supported-visual-c-downloads">官网</a>下载一个<br><a target="_blank" rel="noopener" href="https://support.microsoft.com/zh-cn/help/2977003/the-latest-supported-visual-c-downloads">https://support.microsoft.com/zh-cn/help/2977003/the-latest-supported-visual-c-downloads</a></p>
<br>

<h4 id="如果-mysql-服务不能正常运行，打开后直接停止。"><a href="#如果-mysql-服务不能正常运行，打开后直接停止。" class="headerlink" title="如果 mysql 服务不能正常运行，打开后直接停止。"></a>如果 mysql 服务不能正常运行，打开后直接停止。</h4><p>大概率是 data 初始化失败，即没有完成操作就关闭了.bat<br>请删除 mysql 根目录下的 data 文件夹，然后手动在运行 cmd 运行以下代码。</p>
<figure class="highlight cpp"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><code class="hljs cpp">mysqld --initialize-insecure --user=mysql<br>mysqld -install<br></code></pre></td></tr></table></figure>

<h4 id="workbench-的安装"><a href="#workbench-的安装" class="headerlink" title="workbench 的安装"></a>workbench 的安装</h4><p>workbench 是 mysql 官方的数据库管理软件，相对来说功能很全。</p>
<p><a target="_blank" rel="noopener" href="https://dev.mysql.com/downloads/file/?id=492434">下载链接</a>是这个<a target="_blank" rel="noopener" href="https://dev.mysql.com/downloads/file/?id=492434">https://dev.mysql.com/downloads/file/?id=492434</a><br>直接点击就可以下载，因为下载比较忙，可以拷贝到迅雷下载</p>
<h4 id="修改密码"><a href="#修改密码" class="headerlink" title="修改密码"></a>修改密码</h4><p>最后最后，因为我的配置是跳过了密码所以直接回车就可以，但是如果需要的话，参考一下改密码。 1.运行 cmd，输入<code>mysql -u root -p</code> 出现 password： 直接回车可以进入。</p>
<p>2 进入 mysql 数据库：</p>
<figure class="highlight cpp"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs cpp">use mysql<br></code></pre></td></tr></table></figure>

<p>提示<code>Database changed</code></p>
<p>3 给 root 用户设置新密码：</p>
<figure class="highlight cpp"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs cpp">update user set password=<span class="hljs-built_in">password</span>(<span class="hljs-string">&quot;123456&quot;</span>) where user=<span class="hljs-string">&quot;root&quot;</span>;<br></code></pre></td></tr></table></figure>

<p><strong>别忘了标点</strong></p>
<p>提示：Query OK, 1 rows affected (0.04 sec)Rows matched: 1 Changed: 1 Warnings: 0</p>
<p>4.刷新数据库</p>
<figure class="highlight cpp"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs cpp">flush privileges;<br></code></pre></td></tr></table></figure>

<p>提示：Query OK, 0 rows affected (0.01 sec)</p>
<p>5 退出 mysql：</p>
<figure class="highlight cpp"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs cpp">exit<br></code></pre></td></tr></table></figure>

<p>然后：</p>
<p><strong>根目录找到 my.ini</strong><br><img src="https://img-blog.csdnimg.cn/20200316233006259.png" srcset="/img/loading.gif" lazyload alt="在这里插入图片描述"><br><strong>删除第二行</strong><br><img src="https://img-blog.csdnimg.cn/20200309011728948.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80MzYyNzExOA==,size_16,color_FFFFFF,t_70" srcset="/img/loading.gif" lazyload alt="在这里插入图片描述"></p>
<h4 id="问题通解"><a href="#问题通解" class="headerlink" title="问题通解"></a>问题通解</h4><p>如果问题还没有解决，那打开日志文件。在数据根目录下的 data 里面，有一个<code>.err</code>文件打开它，你就知道真正不能运行的原因是什么。</p>
<figure class="highlight cpp"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs cpp">mysql<span class="hljs-number">-8.0</span><span class="hljs-number">.19</span>-winx64\data\计算机名.err<br></code></pre></td></tr></table></figure>

<h3 id="环境变量-bat"><a href="#环境变量-bat" class="headerlink" title="环境变量.bat"></a>环境变量.bat</h3><figure class="highlight cpp"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><code class="hljs cpp">@echo off<br>set My_PATH=D:\MySQL\mysql<span class="hljs-number">-8.0</span><span class="hljs-number">.19</span>-winx64\bin<br> <span class="hljs-keyword">goto</span> start<br>      =  上面的path改成自己mysql的安装目录下的bin的路径<br>     :start<br>set PATH=%PATH%;%My_PATH%<br>reg add <span class="hljs-string">&quot;HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment&quot;</span> /v <span class="hljs-string">&quot;Path&quot;</span> /t REG_EXPAND_SZ /d <span class="hljs-string">&quot;%PATH%&quot;</span> /f<br><br>mysqld --initialize-insecure --user=mysql<br>mysqld -install<br> <span class="hljs-keyword">goto</span> start2<br>      =  mysql的初始化数据库，和安装<br>     :start2<br>pause<br></code></pre></td></tr></table></figure>

<p>如果运行出现问题，删除 goto 语句即可</p>
<h3 id="my-ini"><a href="#my-ini" class="headerlink" title="my.ini"></a>my.ini</h3><figure class="highlight cpp"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br></pre></td><td class="code"><pre><code class="hljs cpp">[mysqld]<br><span class="hljs-meta"># skip-grant-tables</span><br># 如果不输入密码报错，删除上一句的“#”然后参考前面修改密码。<br># 设置<span class="hljs-number">3306</span>端口<br>port=<span class="hljs-number">3306</span><br><br># 设置mysql的安装目录<br>basedir=D:\\Mysql\\mysql<span class="hljs-number">-8.0</span><span class="hljs-number">.19</span>-winx64<br># 设置mysql数据库的数据的存放目录<br>datadir=D:\\Mysql\\mysql<span class="hljs-number">-8.0</span><span class="hljs-number">.19</span>-winx64\\data<br># 允许最大连接数<br>max_connections=<span class="hljs-number">200</span><br># 允许连接失败的次数。这是为了防止有人从该主机试图攻击数据库系统<br>max_connect_errors=<span class="hljs-number">10</span><br># 服务端使用的字符集默认为UTF8<br>character-set-server=utf8<br># 创建新表时将使用的默认存储引擎<br><span class="hljs-keyword">default</span>-storage-engine=INNODB<br># 默认使用“mysql_native_password”插件认证<br>default_authentication_plugin=mysql_native_password<br>[mysql]<br># 设置mysql客户端默认字符集<br><span class="hljs-keyword">default</span>-character-set=utf8<br>[client]<br># 设置mysql客户端连接服务端时默认使用的端口<br>port=<span class="hljs-number">3306</span><br><span class="hljs-keyword">default</span>-character-set=utf8<br></code></pre></td></tr></table></figure>

<p>标准的安装方式如下：</p>
<ol>
<li>安装 mysql（或者解压）</li>
<li>环境变量</li>
<li>配置 my.ini （即将上文中的 my.ini 放置到 MySQL 根目录</li>
<li>初始化数据库（cmd 运行<code>mysqld --initialize-insecure --user=mysql</code>)</li>
<li>安装数据库(cmd 运行<code>mysqld -install</code>）</li>
</ol>
<br>
<br>
<br>

<blockquote>
<p><strong>写在最后：</strong><br>我叫风骨散人，名字的意思是我多想可以不低头的自由生活，可现实却不是这样。家境贫寒，总得向这个世界低头，所以我一直在奋斗，想<code>改变我的命运</code>给亲人好的生活，希望<code>同样被生活绑架的你</code>可以通过自己的努力改变现状，深知成年人的世界里没有容易二字。目前是一名在校大学生，预计考研，热爱编程，热爱技术，喜欢分享，知识无界，希望我的分享可以帮到你！<br>如果有什么想看的，可以私信我，如果在能力范围内，我会发布相应的博文！<br>谢谢大家的阅读！😘</p>
</blockquote>

                
              </div>
            
            <hr/>
            <div>
              <div class="post-metas my-3">
  
    <div class="post-meta mr-3 d-flex align-items-center">
      <i class="iconfont icon-category"></i>
      

<span class="category-chains">
  
  
    
      <span class="category-chain">
        
  <a href="/categories/%E6%95%B0%E6%8D%AE%E5%BA%93/" class="category-chain-item">数据库</a>
  
  

      </span>
    
  
</span>

    </div>
  
  
</div>


              
  

  <div class="license-box my-3">
    <div class="license-title">
      <div>『数据库』数据库SQL语言从入门到精通-Part 2-MySQL安装</div>
      <div>http://example.com/2023/12/06/『数据库』数据库SQL语言从入门到精通-Part 2-MySQL安装/</div>
    </div>
    <div class="license-meta">
      
        <div class="license-meta-item">
          <div>作者</div>
          <div>Chiam</div>
        </div>
      
      
        <div class="license-meta-item license-meta-date">
          <div>发布于</div>
          <div>2023年12月6日</div>
        </div>
      
      
      
        <div class="license-meta-item">
          <div>许可协议</div>
          <div>
            
              
              
                <a class="print-no-link" target="_blank" href="https://creativecommons.org/licenses/by/4.0/">
                  <span class="hint--top hint--rounded" aria-label="BY - 署名">
                    <i class="iconfont icon-by"></i>
                  </span>
                </a>
              
            
          </div>
        </div>
      
    </div>
    <div class="license-icon iconfont"></div>
  </div>



              
                <div class="post-prevnext my-3">
                  <article class="post-prev col-6">
                    
                    
                      <a href="/2023/12/06/%E3%80%8E%E6%95%B0%E6%8D%AE%E5%BA%93%E3%80%8F%E6%95%B0%E6%8D%AE%E5%BA%93SQL%E8%AF%AD%E8%A8%80%E4%BB%8E%E5%85%A5%E9%97%A8%E5%88%B0%E7%B2%BE%E9%80%9A-Part%203-SQL%E8%AF%AD%E8%A8%80%E5%9F%BA%E7%A1%80%E7%9F%A5%E8%AF%86/" title="『数据库』数据库SQL语言从入门到精通-Part 3-SQL语言基础知识">
                        <i class="iconfont icon-arrowleft"></i>
                        <span class="hidden-mobile">『数据库』数据库SQL语言从入门到精通-Part 3-SQL语言基础知识</span>
                        <span class="visible-mobile">上一篇</span>
                      </a>
                    
                  </article>
                  <article class="post-next col-6">
                    
                    
                      <a href="/2023/12/06/%E3%80%8E%E6%95%B0%E6%8D%AE%E5%BA%93%E3%80%8F%E6%95%B0%E6%8D%AE%E5%BA%93SQL%E8%AF%AD%E8%A8%80%E4%BB%8E%E5%85%A5%E9%97%A8%E5%88%B0%E7%B2%BE%E9%80%9A-Part%201-SQL%E8%AF%AD%E8%A8%80%E6%A6%82%E8%BF%B0/" title="『数据库』数据库SQL语言从入门到精通-Part 1-SQL语言概述">
                        <span class="hidden-mobile">『数据库』数据库SQL语言从入门到精通-Part 1-SQL语言概述</span>
                        <span class="visible-mobile">下一篇</span>
                        <i class="iconfont icon-arrowright"></i>
                      </a>
                    
                  </article>
                </div>
              
            </div>

            
  
  
    <article id="comments" lazyload>
      
  <div id="valine"></div>
  <script type="text/javascript">
    Fluid.utils.loadComments('#valine', function() {
      Fluid.utils.createScript('https://lib.baomitu.com/valine/1.5.1/Valine.min.js', function() {
        var options = Object.assign(
          {"appId":"fIfc7WqUDZohlQuPc2lz5mJy-MdYXbMMI","appKey":"zjlAG3ZA3o4cBHVAkjzc2Z20","path":"window.location.pathname","placeholder":"留言仅限讨论，禁止广告等行为","avatar":"retro","meta":["nick","mail","link"],"requiredFields":[],"pageSize":10,"lang":"zh-CN","highlight":false,"recordIP":false,"serverURLs":"https://fifc7wqu.api.lncldglobal.com","emojiCDN":null,"emojiMaps":null,"enableQQ":false},
          {
            el: "#valine",
            path: window.location.pathname
          }
        )
        new Valine(options);
        Fluid.utils.waitElementVisible('#valine .vcontent', () => {
          var imgSelector = '#valine .vcontent img:not(.vemoji)';
          Fluid.plugins.imageCaption(imgSelector);
          Fluid.plugins.fancyBox(imgSelector);
        })
      });
    });
  </script>
  <noscript>Please enable JavaScript to view the comments</noscript>


    </article>
  


          </article>
        </div>
      </div>
    </div>

    <div class="side-col d-none d-lg-block col-lg-2">
      
  <aside class="sidebar" style="margin-left: -1rem">
    <div id="toc">
  <p class="toc-header">
    <i class="iconfont icon-list"></i>
    <span>目录</span>
  </p>
  <div class="toc-body" id="toc-body"></div>
</div>



  </aside>


    </div>
  </div>
</div>





  



  



  



  



  







    

    
      <a id="scroll-top-button" aria-label="TOP" href="#" role="button">
        <i class="iconfont icon-arrowup" aria-hidden="true"></i>
      </a>
    

    
      <div class="modal fade" id="modalSearch" tabindex="-1" role="dialog" aria-labelledby="ModalLabel"
     aria-hidden="true">
  <div class="modal-dialog modal-dialog-scrollable modal-lg" role="document">
    <div class="modal-content">
      <div class="modal-header text-center">
        <h4 class="modal-title w-100 font-weight-bold">搜索</h4>
        <button type="button" id="local-search-close" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body mx-3">
        <div class="md-form mb-5">
          <input type="text" id="local-search-input" class="form-control validate">
          <label data-error="x" data-success="v" for="local-search-input">关键词</label>
        </div>
        <div class="list-group" id="local-search-result"></div>
      </div>
    </div>
  </div>
</div>

    

    
  </main>

  <footer>
    <div class="footer-inner">
  
    <div class="footer-content">
       <meta name="referrer" content="no-referrer" /> <footer id="footer" role="contentinfo"> <div class="divider"> <div class="wall"></div> <img class="animals" src="/img/footer_animals_new.png" srcset="/img/loading.gif" lazyload alt="Footer Animals"> </div> <div class="container" data-index="450"> <p> <a href="https://chiamzhang.github.io" target="_blank">DogEgg</a> <i class="iconfont icon-love"></i> <a href="#" target="_blank">LittePig</a> </p> <p> Powered by  <a href="https://hexo.io" target="_blank" rel="nofollow noopener"><span>Hexo</span></a> <i class="iconfont icon-pen"></i> Theme  <a href="https://github.com/fluid-dev/hexo-theme-fluid" target="_blank" rel="nofollow noopener"><span>Fluid</span></a> </p> </div> </footer> 
    </div>
  
  
  
  
</div>

  </footer>

  <!-- Scripts -->
  
  <script  src="https://lib.baomitu.com/nprogress/0.2.0/nprogress.min.js" ></script>
  <link  rel="stylesheet" href="https://lib.baomitu.com/nprogress/0.2.0/nprogress.min.css" />

  <script>
    NProgress.configure({"showSpinner":false,"trickleSpeed":100})
    NProgress.start()
    window.addEventListener('load', function() {
      NProgress.done();
    })
  </script>


<script  src="https://lib.baomitu.com/jquery/3.6.4/jquery.min.js" ></script>
<script  src="https://lib.baomitu.com/twitter-bootstrap/4.6.1/js/bootstrap.min.js" ></script>
<script  src="/js/events.js" ></script>
<script  src="/js/plugins.js" ></script>


  <script  src="https://lib.baomitu.com/typed.js/2.0.12/typed.min.js" ></script>
  <script>
    (function (window, document) {
      var typing = Fluid.plugins.typing;
      var subtitle = document.getElementById('subtitle');
      if (!subtitle || !typing) {
        return;
      }
      var text = subtitle.getAttribute('data-typed-text');
      
        typing(text);
      
    })(window, document);
  </script>




  
    <script  src="/js/img-lazyload.js" ></script>
  




  
<script>
  Fluid.utils.createScript('https://lib.baomitu.com/tocbot/4.20.1/tocbot.min.js', function() {
    var toc = jQuery('#toc');
    if (toc.length === 0 || !window.tocbot) { return; }
    var boardCtn = jQuery('#board-ctn');
    var boardTop = boardCtn.offset().top;

    window.tocbot.init(Object.assign({
      tocSelector     : '#toc-body',
      contentSelector : '.markdown-body',
      linkClass       : 'tocbot-link',
      activeLinkClass : 'tocbot-active-link',
      listClass       : 'tocbot-list',
      isCollapsedClass: 'tocbot-is-collapsed',
      collapsibleClass: 'tocbot-is-collapsible',
      scrollSmooth    : true,
      includeTitleTags: true,
      headingsOffset  : -boardTop,
    }, CONFIG.toc));
    if (toc.find('.toc-list-item').length > 0) {
      toc.css('visibility', 'visible');
    }

    Fluid.events.registerRefreshCallback(function() {
      if ('tocbot' in window) {
        tocbot.refresh();
        var toc = jQuery('#toc');
        if (toc.length === 0 || !tocbot) {
          return;
        }
        if (toc.find('.toc-list-item').length > 0) {
          toc.css('visibility', 'visible');
        }
      }
    });
  });
</script>


  <script src=https://lib.baomitu.com/clipboard.js/2.0.11/clipboard.min.js></script>

  <script>Fluid.plugins.codeWidget();</script>


  
<script>
  Fluid.utils.createScript('https://lib.baomitu.com/anchor-js/4.3.1/anchor.min.js', function() {
    window.anchors.options = {
      placement: CONFIG.anchorjs.placement,
      visible  : CONFIG.anchorjs.visible
    };
    if (CONFIG.anchorjs.icon) {
      window.anchors.options.icon = CONFIG.anchorjs.icon;
    }
    var el = (CONFIG.anchorjs.element || 'h1,h2,h3,h4,h5,h6').split(',');
    var res = [];
    for (var item of el) {
      res.push('.markdown-body > ' + item.trim());
    }
    if (CONFIG.anchorjs.placement === 'left') {
      window.anchors.options.class = 'anchorjs-link-left';
    }
    window.anchors.add(res.join(', '));

    Fluid.events.registerRefreshCallback(function() {
      if ('anchors' in window) {
        anchors.removeAll();
        var el = (CONFIG.anchorjs.element || 'h1,h2,h3,h4,h5,h6').split(',');
        var res = [];
        for (var item of el) {
          res.push('.markdown-body > ' + item.trim());
        }
        if (CONFIG.anchorjs.placement === 'left') {
          anchors.options.class = 'anchorjs-link-left';
        }
        anchors.add(res.join(', '));
      }
    });
  });
</script>


  
<script>
  Fluid.utils.createScript('https://lib.baomitu.com/fancybox/3.5.7/jquery.fancybox.min.js', function() {
    Fluid.plugins.fancyBox();
  });
</script>


  <script>Fluid.plugins.imageCaption();</script>

  <script  src="/js/local-search.js" ></script>




  
<script src="/js/love.js"></script>
<script src="/js/funnyTitle.js"></script>
<script src="/js/backTop.js"></script>
<script src="//cdn.jsdelivr.net/gh/bynotes/texiao/source/js/xiaoxuehua.js"></script>



<!-- 主题的启动项，将它保持在最底部 -->
<!-- the boot of the theme, keep it at the bottom -->
<script  src="/js/boot.js" ></script>


  

  <noscript>
    <div class="noscript-warning">博客在允许 JavaScript 运行的环境下浏览效果更佳</div>
  </noscript>
<script src="/live2dw/lib/L2Dwidget.min.js?094cbace49a39548bed64abff5988b05"></script><script>L2Dwidget.init({"pluginRootPath":"live2dw/","pluginJsPath":"lib/","pluginModelPath":"assets/","tagMode":false,"debug":false,"model":{"jsonPath":"/live2dw/assets/wanko.model.json"},"display":{"position":"left","width":150,"height":150,"hOffset":20,"vOffset":0},"mobile":{"show":false,"scale":0.5},"react":{"opacity":0.9},"log":false});</script></body>
</html>
